home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / amiga / myhookentry.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-21  |  884 b   |  59 lines

  1. #include <Amiga.h>
  2. #include <utility/hooks.h>
  3.  
  4. /************************************************************************/
  5.  
  6. #if defined(__SASC)
  7.  
  8. ULONG __SAVEDS __asm MyHookEntry(register __a0 struct Hook *Hook,
  9.                  register __a2 APTR Object,
  10.                  register __a1 APTR Message)
  11.  
  12. {
  13.   return Hook->h_SubEntry(Hook,Object,Message);
  14. }
  15.  
  16. /************************************************************************/
  17.  
  18. #elif defined(__GNUC__)
  19.  
  20. __asm("
  21.     .text
  22.     .globl _MyHookEntry
  23. _MyHookEntry:
  24. "
  25. #ifdef SMALL_DATA
  26. "    movml a4/a1,SP@-
  27. "
  28. #else
  29. "    movl a1,SP@-
  30. "
  31. #endif
  32. "    movml a2/a0,SP@-
  33. "
  34. #ifdef SMALL_DATA
  35. #ifdef SMALL_CODE
  36. "    jsr PC@(__geta4+2)
  37. "
  38. #else
  39. "    jsr __geta4
  40. "
  41. #endif
  42. #endif
  43. "    movl a0@(12),a0
  44.     jsr a0@
  45.     lea SP@(12),SP
  46. "
  47. #ifdef SMALL_DATA
  48. "    movl SP@+,a4
  49. "
  50. #endif
  51. "    rts
  52. ");
  53.  
  54. /************************************************************************/
  55.  
  56. #else
  57. #error Compiler not supported
  58. #endif
  59.